home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / ppp / dp-2.3 / h / dp_str.h next >
Encoding:
C/C++ Source or Header  |  1992-05-22  |  6.8 KB  |  207 lines

  1. /* ppp_str.h - streams version include file defines ioctl calls for MRU, COMPPROT and ASYNCMAP */
  2. /*
  3.  * Copyright (C) 1990 Brad K. Clements, All Rights Reserved, See copyright statement
  4.    in Readme.streams
  5. */
  6. /*
  7.  * Copyright (c) 1992 Purdue University
  8.  * All rights reserved.
  9.  *
  10.  * Redistribution and use in source and binary forms are permitted
  11.  * provided that the above copyright notice and this paragraph are
  12.  * duplicated in all such forms and that any documentation,
  13.  * advertising materials, and other materials related to such
  14.  * distribution and use acknowledge that the software was developed
  15.  * by Purdue University.  The name of the University may not be used
  16.  * to endorse or promote products derived * from this software without
  17.  * specific prior written permission.
  18.  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
  19.  * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
  20.  * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
  21.  *
  22.  * Note: this copyright applies to portions of this software developed
  23.  * at Purdue beyond the software covered by the original copyright.
  24.  */
  25.  
  26. #include    <sys/ioccom.h>
  27.  
  28. #define    SIOCSIFCOMPAC    _IOW(p, 130, char)
  29. #define    SIOCSIFCOMPPROT    _IOW(p, 131, char)
  30. #define    SIOCSIFMRU    _IOW(p, 132, int)
  31. #define    SIOCGIFMRU    _IOR(p, 133, int)
  32. #define    SIOCGIFASYNCMAP    _IOR(p, 134, long)
  33. #define    SIOCSIFASYNCMAP    _IOW(p, 135, long)
  34. #define    SIOCGETU    _IOR(p, 136, int)  /* get unit number */
  35. #define    SIOCSIFVJCOMP    _IOW(p, 137, char) /* enable/disable VJ Compression */
  36.  
  37. /*
  38.  * Newly defined stuff for Dialup options.
  39.  */
  40. #define    SIOCSIFUNIT    _IOW(p, 138, int)    /* Set unit number */
  41. #define    SIOCGIFUNIT    _IOR(p, 139, int)    /* Get unit number */
  42. #define    SIOCCALLSTAT    _IOW(p, 140, char)    /* Call status */
  43.  
  44. #define    SIOCSDPTIMEO    _IOW(p, 141, dp_timeo)    /* Set Timeouts */
  45. #define    SIOCGDPTIMEO    _IOR(p, 142, dp_timeo)    /* Get Timeouts */
  46.  
  47. /*
  48.  * Call status values
  49.  */
  50. #define    DP_FAILURE    0    /* Failure to establish modem connection */
  51. #define    DP_SUCCESS    1    /* Connection is established */
  52. #define    DP_IN_PROGRESS    2    /* Connect is being established */
  53. #define    DP_NO_MODEM    3    /* No modem is available */
  54. #define DP_VALID_STATUS(s)    ((s) >= 0 && (s) <= 3)
  55. /*
  56.  * These ioctls can be applied to an interface even if there is
  57.  * no associated stream.
  58.  */
  59. #define SIOCICALLSTAT    _IOW(i, 64, struct ifreq)  /* Report Call Status */
  60. #define    SIOCSDPIATIMEO    _IOW(i, 65, struct ifreq)  /* Set Activity Timeouts */
  61. #define    SIOCGDPIATIMEO    _IOWR(i, 66, struct ifreq) /* Get Activity Timeouts */
  62. #define    SIOCSDPICTIMEO    _IOW(i, 67, struct ifreq)  /* Set Call Timeouts */
  63. #define    SIOCGDPICTIMEO    _IOWR(i, 68, struct ifreq) /* Get Call Timeouts */
  64. #define    SIOCGDPIISTATS    _IOWR(i, 69, struct ifreq) /* Get Input Stats */
  65. #define    SIOCGDPIOSTATS    _IOWR(i, 70, struct ifreq) /* Get Output Stats */
  66.  
  67. /*
  68.  * Bits for pii_flags.
  69.  */
  70. #define    PII_FLAGS_INUSE        0x0001    /* in use by  a stream    */
  71. #define    PII_FLAGS_COMPAC    0x0002
  72. #define    PII_FLAGS_COMPPROT    0x0004
  73. #define    PII_FLAGS_ATTACHED    0x0008    /* already if_attached    */
  74. #define    PII_FLAGS_INITTED    0x0040    /* already if_initted    */
  75. #define    PII_FLAGS_VJC_ON    0x0010    /* VJ TCP header compression enabled */
  76. #define    PII_FLAGS_DIALUP    0x0020    /* Operate in dialup on demand mode */
  77. #define    PII_FLAGS_ACTIVE    0x0040    /* Keep track of active connections */
  78.  
  79. /*
  80.  * Values for pii_dustate.
  81.  */
  82. #define    PII_DPS_ACTIVE        0    /* Active */
  83. #define    PII_DPS_ACTIVEC        1    /* Not used */
  84. #define    PII_DPS_ACTIVEU        2    /* Not used */
  85. #define    PII_DPS_WAITING        3    /* Waiting for call completion */
  86. #define    PII_DPS_FAILCALL    4    /* After failed call */
  87. #define    PII_DPS_DISCON        5    /* Not connected */
  88. #define    PII_DPS_DOWN        6    /* Shouldn't try to connect */
  89.  
  90. #define    PII_DP_NSTATES        7
  91. /*
  92.  * Constants related to the timeout mechanism
  93.  * Array indices are defined for the states which have timeouts.
  94.  * Also, default settings for timeouts.
  95.  */
  96. #define    DP_ATIMEO    PII_DPS_ACTIVE    /* Activity with open TCP connections */
  97. #define    DP_CTIMEO    PII_DPS_ACTIVEC    /* Activity after last TCP close */
  98. #define    DP_UTIMEO    PII_DPS_ACTIVEU    /* Activity for non-TCP traffic only */
  99. #define    DP_WTIMEO    PII_DPS_WAITING    /* Call Wait Timeout */
  100. #define    DP_FTIMEO    PII_DPS_FAILCALL/* Failed Call Timeout */
  101. #define    DP_ATIMEOUTS    0        /* First Activity Timeout */
  102. #define    DP_NATIMEOUTS    3        /* Number of activity timeouts */
  103. #define    DP_CTIMEOUTS    DP_NATIMEOUTS    /* First Call Timeout */
  104. #define    DP_NCTIMEOUTS    2        /* Number of call timeouts */
  105. #define    DP_NTIMEOUTS    (DP_NATIMEOUTS + DP_NCTIMEOUTS)
  106.                     /* Number of timeouts */
  107.  
  108. #define DP_HZ        5        /* 5 second granularity */
  109. #define    DP_NO_TIMEOUT    (-1)
  110. #define    DP_DEF_TIMEOUT    (-2)
  111. #define DP_DEF_ATIMEO    (2 * 60)    /* 2 minutes */
  112. #define DP_DEF_WTIMEO    (1 * 60)    /* 1 minute */
  113. #define DP_DEF_FTIMEO    (1 * 60)    /* 1 minute */
  114. #define DP_DEF_CTIMEO    DP_NO_TIMEOUT    /* */
  115. #define DP_DEF_UTIMEO    DP_NO_TIMEOUT    /* */
  116.  
  117. #define    DP_ACTIVE
  118. #ifdef    DP_ACTIVE
  119. /*
  120.  * Data structures to monitor the active conversations on a PPP interface.
  121.  */
  122. #define    MAX_ACTIVE    16
  123. #define    DC_ACTIVE    1
  124.  
  125. struct  dp_conv {
  126.     struct dp_conv *dc_next;
  127.     int    dc_flags;
  128.     struct in_addr dc_ip_src,  dc_ip_dst;
  129.     u_short dc_th_sport, dc_th_dport;
  130. };
  131.  
  132. struct dp_ctab {
  133.     struct dp_conv *dt_last;
  134.     struct dp_conv dt_conv[MAX_ACTIVE];
  135. };
  136.  
  137. struct  dp_active {
  138.     int da_nactive;            /* Number of active conversations */
  139.     int da_lookups,            /* Total table searches */
  140.     da_misses;            /* Cache misses */
  141.     struct dp_ctab da_ttab,        /* Transmit conversation table */
  142.            da_rtab;        /* Receive conversation table */
  143. };
  144. #endif
  145.  
  146. struct    dp_if_info {
  147.     int    pii_flags;
  148.     struct    ifnet    pii_ifnet;
  149.     queue_t        *pii_writeq;        /* used by ppp_output     */
  150. #ifdef    VJC
  151.     struct     slcompress    pii_sc_comp;    /* vjc control buffer */
  152. #endif
  153. #ifdef    PPP_STATS
  154.     struct slipstat        pii_stats;
  155. #endif
  156. #ifdef    DP_ACTIVE
  157.     struct dp_active    pii_active;
  158. #endif
  159.     int pii_dustate;
  160.  
  161.     long pii_timo[PII_DP_NSTATES];        /* Timeouts */
  162.     long pii_timer,                /* Normal timeout */
  163.          pii_ftimer;            /* Fast timeout */
  164.     queue_t *pii_q;                /* Associated Queue */
  165. };
  166.  
  167. typedef struct dp_timeo {
  168.     int timeo[DP_NTIMEOUTS];
  169. } dp_timeo;
  170.  
  171. #define    DR_MINHDRLEN    (sizeof(struct ip))
  172. #define    DR_MAXHDRLEN    (sizeof(struct ip) + 2 * sizeof(u_short))
  173.  
  174. typedef struct dp_reqinfo {
  175.     char dri_ifname[8];
  176.     int dri_ifunit;
  177.     int dri_flag;
  178.     struct sockaddr_in dri_sin;
  179.     int dri_hdrlen;
  180. } dp_reqinfo;
  181.  
  182. typedef union dp_reqhdr {
  183.     char drh_data[DR_MAXHDRLEN];
  184.     struct ip drh_ip;
  185. } dp_reqhdr;
  186.  
  187. typedef struct dp_req {
  188.     struct dp_reqinfo dr_info;
  189.     union dp_reqhdr dr_hdr;
  190. } dp_req;
  191.  
  192. #define    dr_ifname    dr_info.dri_ifname
  193. #define    dr_ifunit    dr_info.dri_ifunit
  194. #define    dr_flag        dr_info.dri_flag
  195. #define    dr_sin        dr_info.dri_sin
  196. #define    dr_hdrlen    dr_info.dri_hdrlen
  197.  
  198. #define    dr_data        dr_hdr.drh_data
  199. #define    dr_ip        dr_hdr.drh_ip
  200. #define    dr_tcpip    dr_hdr.drh_tcpip
  201. #define    dr_udpip    dr_hdr.drh_udpip
  202.  
  203. #define DP_REQ_CHECKIT    1
  204.  
  205. #define DP_HIWAT    (5 * sizeof(struct dp_req))
  206. #define DP_LOWAT    (4 * sizeof(struct dp_req))
  207.